﻿using System.Collections.Generic;
using SplitToDoList;
using TestBasecampRestAPI.TestBasecampUI;

namespace TestBasecampRestAPI.TestSplitToDoList
{
	class FakeMainForm : FakeCredentialsMainForm, IMainForm
	{
		public new static FakeMainForm GetInstance()
		{
			return new FakeMainForm();
		}
		private FakeMainForm()
		{
		}

		#region Implementation of IMainForm

		public int ProjectSelectedIndex
		{
			get
			{
				ProjectSelectedIndexGetCalled = true;
				return ProjectSelectedIndexGetFakeResult;
			}
			set
			{
				ProjectSelectedIndexSetCalled = true;
				ProjectSelectedIndexSetLastValue = value;
			}
		}
		public bool ProjectSelectedIndexGetCalled { get; private set; }
		public int ProjectSelectedIndexGetFakeResult { private get; set; }
		public bool ProjectSelectedIndexSetCalled { get; private set; }
		public int ProjectSelectedIndexSetLastValue { get; private set; }

		public int ToDoListSelectedIndex
		{
			get
			{
				ToDoListSelectedIndexGetCalled = true;
				return ToDoListSelectedIndexGetFakeResult;
			}
			set
			{
				ToDoListSelectedIndexSetCalled = true;
				ToDoListSelectedIndexSetLastValue = value;
			}
		}
		public bool ToDoListSelectedIndexGetCalled { get; private set; }
		public int ToDoListSelectedIndexGetFakeResult { private get; set; }
		public bool ToDoListSelectedIndexSetCalled { get; private set; }
		public int ToDoListSelectedIndexSetLastValue { get; private set; }

		public void AddProject(string name)
		{
			AddProjectCalled = true;
			AddProjectLastNames.Add(name);
		}
		public bool AddProjectCalled { get; private set; }
		private readonly IList<string> AddProjectLastNames = new List<string>();
		public bool AddProjectCalledFor(string name)
		{
			return AddProjectLastNames.Contains(name);
		}
		public int AddProjectIndexFor(string name)
		{
			return AddProjectLastNames.IndexOf(name);
		}

		public void ClearToDoLists()
		{
			ClearToDoListsCalled = true;
		}
		public bool ClearToDoListsCalled { get; private set; }

		public void ToDoListsAddItem(string item)
		{
			ToDoListsAddItemCalled = true;
			ToDoListsAddItemLastItem = item;
			ToDoListsAddItemLastItems.Add(item);
		}
		public bool ToDoListsAddItemCalled { get; private set; }
		public string ToDoListsAddItemLastItem { get; private set; }
		private readonly List<string> ToDoListsAddItemLastItems = new List<string>();

		public void ClearToDoListItems()
		{
			ClearToDoListItemsCalled = true;
		}
		public bool ClearToDoListItemsCalled { get; private set; }

		public void ToDoListItemsAddItem(string item)
		{
			ToDoListItemsAddItemCalled = true;
			ToDoListItemsAddItemLastItem = item;
			ToDoListItemsAddItemLastItems.Add(item);
		}
		public bool ToDoListItemsAddItemCalled { get; private set; }
		public string ToDoListItemsAddItemLastItem { get; private set; }
		private readonly List<string> ToDoListItemsAddItemLastItems = new List<string>();

		public bool SplitButtonEnabled
		{
			set
			{
				SplitButtonEnabledSetCalled = true;
				SplitButtonEnabledSetLastValue = value;
			}
		}
		public bool SplitButtonEnabledSetCalled { get; private set; }
		public bool SplitButtonEnabledSetLastValue { get; private set; }

		public string NewListName
		{
			get { NewListNameGetCalled = true; return NewListNameGetFakeResult; }
		}
		public bool NewListNameGetCalled { get; private set; }
		public string NewListNameGetFakeResult { private get; set; }

		public int[] SelectedListItems
		{
			get
			{
				SelectedListItemsGetCalled = true;
				return SelectedListItemsGetFakeResult;
			}
		}
		public bool SelectedListItemsGetCalled { get; private set; }
		public int[] SelectedListItemsGetFakeResult { private get; set; }

		#endregion
	}
}
